package com.coincalf.admin.web.vo.mappers;

import com.coincalf.admin.entity.SysRolePrivilege;
import com.coincalf.admin.web.vo.GrantPrivilegesForm;

import java.util.ArrayList;
import java.util.List;

/**
 * @author qiang
 */
public class GrantPrivilegesMapper {

    public static List<SysRolePrivilege> convertPrivilegeList(GrantPrivilegesForm form) {
        List<SysRolePrivilege> sysRolePrivileges = new ArrayList<>();
        for (Long privilegeId : form.getPrivilegeIds()) {
            sysRolePrivileges.add(new SysRolePrivilege()
                    .setRoleId(form.getRoleId())
                    .setPrivilegeId(privilegeId));
        }
        return sysRolePrivileges;
    }
}